package com.bt7274.enums;

/**
 * 常驻活动类型
 *
 * @return null
 * @author galland
 */
public enum PermanentPromotionType {

    DAILY_LOGIN("每日登录", "每日首次登录获得BT币", 10),
    CONSECUTIVE_LOGIN("连续登录", "连续登录获得递增奖励", 0),
    ACTIVE_SEEDS_20("活跃做种-20个", "同时做种数达到20个", 100),
    ACTIVE_SEEDS_50("活跃做种-50个", "同时做种数达到50个", 300);

    private final String title;
    private final String description;
    private final int baseReward; // 基础奖励BT币

    PermanentPromotionType(String title, String description, int baseReward) {
        this.title = title;
        this.description = description;
        this.baseReward = baseReward;
    }

    public String getTitle() {
        return title;
    }

    public String getDescription() {
        return description;
    }

    public int getBaseReward() {
        return baseReward;
    }

    /**
     * 计算连续登录奖励
     * @param consecutiveDays 连续登录天数
     * @return 奖励BT币数量
     */
    public static int calculateConsecutiveLoginReward(int consecutiveDays) {
        if (consecutiveDays <= 0) return 0;

        // 递增奖励规则
        if (consecutiveDays <= 7) {
            return 10 + (consecutiveDays - 1) * 5; // 第1天10，第2天15，...第7天40
        } else if (consecutiveDays <= 30) {
            return 50; // 7天后每天50
        } else if (consecutiveDays <= 100) {
            return 80; // 30天后每天80
        } else {
            return 100; // 100天后每天100
        }
    }

    /**
     * 获取连续登录里程碑奖励
     * @param consecutiveDays 连续登录天数
     * @return 额外奖励BT币数量
     */
    public static int getConsecutiveMilestoneReward(int consecutiveDays) {
        switch (consecutiveDays) {
            case 7:
                return 100;  // 7天额外奖励
            case 30:
                return 300;  // 30天额外奖励
            case 100:
                return 500; // 100天额外奖励
            case 365:
                return 1000; // 365天额外奖励
            default:
                return 0;
        }
    }
}